package bz.yfw.example.s3blazeds.part2.helper
{
	import bz.yfw.example.s3blazeds.part2.model.view.EmpViewModel;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditConfirmView;
	
	import org.seasar.akabana.yui.framework.ns.viewpart;
	
	import spark.components.Label;
	import spark.primitives.BitmapImage;
	
	use namespace viewpart;

	public class EmpEditConfirmInitHelper
	{
		public var view:EmpEditConfirmView;
		
		viewpart var lblName:Label;
		
		viewpart var lblSex:Label;
		
		viewpart var lblBirthDate:Label;
		
		viewpart var lblAddress:Label;
		
		viewpart var lblTel:Label;
		
		viewpart var lblEmail:Label;
		
		viewpart var lblEnterCompanyDate:Label;
		
		viewpart var lblPosition:Label;
		
		viewpart var bmpimgShashin:BitmapImage;
		
		public function get empViewModel():EmpViewModel {
			
			// 戻る -> 次へボタン押下後の復元情報 
			if (view.data && view.data is EmpViewModel) {
				return view.data as EmpViewModel;
			}
			return null;
		}
		
		public function reflectEmpModel():void {
			var vm:EmpViewModel = empViewModel;
			
			lblName.text = vm.name;
			lblSex.text = vm.sex == "man" ? "男性" : "女性";
			lblBirthDate.text = 
				vm.year + "年" + vm.month + "月" + vm.date + "日";
			lblAddress.text = vm.address;
			lblEmail.text = vm.emailL + "@" + vm.emailR;
			lblEnterCompanyDate.text = 
				vm.enterCompanyY + "年" 
			  + vm.enterCompanyM + "月" 
			  + vm.enterCompanyD + "日";
			lblPosition.text = 
				vm.position;
			lblTel.text = vm.telL + "-" + vm.telC + "-" + vm.telR;
 			bmpimgShashin.source = vm.shashin;
		}
	}
}